import request from '../utils/request.js'
import store from '../store/index.js'
export function createNews(news){
    return request({
        url: 'news/',
        method: 'post',
        data: news
      })
}

export function getAllNews(){
    return request({
        url: 'news/all',
        method: 'get'
    })
}

export function getNewsByNewsPartId(){
    return request({
        url: 'news/part/' + store.getters.userPartId,
        method: 'get'
    })
}

export function getNewsByNewsId(newsId){
    return request({
        url: 'news/' + newsId,
        method: 'get'
    })
}

export function deleteNews(newsId){
    return request({
        url: 'news/' + newsId,
        method: 'delete',
    })
}

export function auditNews(newsId){
    return request({
        url: 'news/pub',
        method: 'get'
    })
}

export function getNewsByNewstype(newsType){
    return request({
        url: 'news/type/' + newsType,
        method: 'get'
    })
}

export function conditionSearchNews(condition) {
    return request({
      url: 'news/condition',
      method: 'get',
      params: condition
    })
  }